//
//  GatherIndicatorInfo.m
//  YYTextTest
//
//  Created by macintosh on 16/9/12.
//  Copyright © 2016年 macintosh. All rights reserved.
//

#import "GatherIndicatorInfo.h"

@implementation GatherIndicatorInfo

+ (instancetype)infoWithTitle:(NSString *)title
                  detailTitle:(NSString *)detailTitle
                  pickerDatas:(NSArray *)pickerDatas
                selectedIndex:(NSInteger)selectedIndex
                     isOpened:(BOOL)isOpened;
{
    GatherIndicatorInfo *info = [GatherIndicatorInfo new];
    info.title = title;
    info.detailTitle = detailTitle;
    info.pickerDatas = pickerDatas;
    info.selectedIndex = selectedIndex;
    info.isOpened = isOpened;
    return info;
}

- (void)encodeWithCoder:(NSCoder *)aCoder
{
    [aCoder encodeObject:_title forKey:@"title"];
    [aCoder encodeObject:_detailTitle forKey:@"detailTitle"];
    [aCoder encodeObject:_pickerDatas forKey:@"pickerDatas"];
    [aCoder encodeInteger:_selectedIndex forKey:@"selectedIndex"];
    [aCoder encodeBool:_isOpened forKey:@"isOpened"];
}

- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder
{
    GatherIndicatorInfo *info = [GatherIndicatorInfo new];
    info.title = [aDecoder decodeObjectForKey:@"title"];
    info.detailTitle = [aDecoder decodeObjectForKey:@"detailTitle"];
    info.pickerDatas = [aDecoder decodeObjectForKey:@"pickerDatas"];
    info.selectedIndex = [aDecoder decodeIntegerForKey:@"selectedIndex"];
    info.isOpened = [aDecoder decodeBoolForKey:@"isOpened"];
    return info;
}

- (id)copyWithZone:(NSZone *)zone {
    GatherIndicatorInfo *info = [[[self class] allocWithZone:zone] init];
    info.title = self.title;
    info.detailTitle = self.detailTitle;
    info.pickerDatas = self.pickerDatas;
    info.selectedIndex = self.selectedIndex;
    info.isOpened = self.isOpened;
    return info;
}

@end
